<template>
    <h1>Welcome to VUE3</h1>
    <h2>{{ person.name }}</h2>
    <h2>{{ person.age }}</h2>
    <h2>{{ person.job.salary }}</h2>
    <h2>{{ person.job.type }}</h2>
    <button @click="showName">showName</button>
</template>

<script>
import { reactive, ref } from "@vue/reactivity";

export default {
    name: "App",
    setup() {
        let person = reactive({
            name: "zs",
            age: 10,
            job: {
                type: "前端工程师",
                salary: "10k",
            },
        });
        // let name = ref("zs");
        // let age = ref(12);
        // let job = ref({
        //     type: "前端工程师",
        //     salary: "2K",
        // });
        // let job1 = reactive({
        //     type: "前端工程师",
        //     salary: "2K",
        // });
        function showName() {
            // alert(name)
            (person.name = "张三"),
                (person.age = 100),
                (person.job.type = "UI"),
                (person.job.salary = "20K");
                console.log(person);
        }
        return {
            // name,
            // age,
            showName,
            // job,
            // job1
            person,
        };
    },
};
</script>

<style>
#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
}
</style>
